package com.landleaf.smarthome.device;

import com.landleaf.smarthome.model.DeviceAttribute;

import java.util.HashMap;
import java.util.Map;

/**
 * When I wrote this, only God and I understood what I was doing
 * Now, God only knows
 * Created by 海航
 * 2020/8/31
 * 功能描述:
 */
@ProductCodeAnnotation(ProductCodeConst.VRV)
public class DJVRVModel extends BaseLocalDeviceModel {
    private static volatile DJVRVModel singleton = null;

    private DJVRVModel() {
    }

    public static DJVRVModel getInstance() {
        if (singleton == null) {
            synchronized (DJVRVModel.class) {
                if (singleton == null) {
                    singleton = new DJVRVModel();
                }
            }
        }
        return singleton;
    }


    @Override
    public int getStartAdd() {
        return 0;
    }

    @Override
    public int getAddLength() {
        return 100;
    }

    @Override
    public boolean getIsMultiple() {
        return true;
    }

    public Map<String, Integer> getAttTagAdd() {
        if (attTagAdd == null) {
            attTagAdd = new HashMap<>();
            attTagAdd.put(AttributeTagConst.SWITCH, 0x12);
        }

        return attTagAdd;
    }


    public Map<String, DeviceAttribute> getAttValueAdd() {
        if (attValueAdd == null) {
            attValueAdd = new HashMap<>();
            attValueAdd.put(AttributeValueConst.OPEN, new DeviceAttribute(AttributeTagConst.SWITCH, 1));
            attValueAdd.put(AttributeValueConst.CLOSE, new DeviceAttribute(AttributeTagConst.SWITCH, 2));
            attValueAdd.put(AttributeValueConst.MODE_COLD, new DeviceAttribute(AttributeTagConst.SYS_MODE, 1));
            attValueAdd.put(AttributeValueConst.MODE_HOT, new DeviceAttribute(AttributeTagConst.SYS_MODE, 2));
            attValueAdd.put(AttributeValueConst.MODE_WIND, new DeviceAttribute(AttributeTagConst.SYS_MODE, 3));
            attValueAdd.put(AttributeValueConst.MODE_DEHUMI, new DeviceAttribute(AttributeTagConst.SYS_MODE, 4));
        }
        return attValueAdd;
    }


}
